1. Field of the Invention
The present invention relates generally to a computer implemented method, data processing system, and computer program product for caching disk data to memory. More specifically, the present invention relates to tracking potential candidate pages for paging-out and re-assessing their candidacy before a page-out occurs.
2. Description of the Related Art
In a computer system, Random Access Memory (RAM) contains the instructions or program to execute and the data necessary to execute those instructions. The resulting data from execution of the program code is also stored back into the RAM.
Modern computer systems use a Virtual Memory Manager (VMM) to provide on-demand paging to extend the size of memory. Such computer systems provide this feature because only the actual instructions and data required at a given point in time for execution need to reside in memory. The remaining portions of a program's instructions may be stored on disk until they are needed. The space where such instructions are stored is sometimes called paging space. Such a system can be complicated when there are multiple applications that run concurrently, or otherwise compete to use system resources.
System architects divide memory into units, often of equal sizes. These units are referred to as pages or frames. When a portion of a program's code or data is needed in RAM, it will be brought in one page at a time. Similarly, when a portion of a program or data is no longer needed in RAM it will be removed from the RAM to make room for other instructions or data. Thus, a memory page is a virtual block of storage, in either physical memory or persistent storage. Physical memory is volatile storage, such as, for example, RAM. Persistent storage is memory that requires no refreshing current to maintain data within the device.
The VMM manages the translation between the effective size of memory and the physical size of memory. The effective size of memory is also called the effective memory address range. The physical size of memory is also called the physical memory address range. The VMM maintains a map, which is used to translate the effective address of a page to the physical location of that page in RAM. This feature is known as a page translation. The entries in this map are called Page Translation Entries (PTE). When an effective memory address is accessed, which is not in physical memory, a page fault occurs. To satisfy the page fault and allow execution to continue, a memory page in physical memory will be selected for replacement if there are no free pages in physical memory. A page fault is an interrupt or an exception to the software raised by the undergirding hardware to indicate that a memory page mapped in address space is not resident in a particular place of physical memory. The reasons for the fault may vary. For example, the memory page may only be present in persistent storage and not found in physical memory. A page fault may also occur when a memory page is present in physical memory, but its status is not updated as present in hardware, at least with respect to the particular place of physical memory to which the memory page had primarily been assigned.
The VMM is responsible for steps such as selecting the memory page to replace, removing the contents of that page out of RAM, removing the PTE, loading the replacement memory page into physical memory, and adding a PTE. The data processing system continues program execution following these steps.
The VMM can use a variety of page replacement criteria when selecting memory pages in physical memory to be replaced with newly requested data. These criteria may be based on, for example, freshness of memory page access, and a number of times the memory page has been brought back into physical memory (re-paged). One example of a page replacement policy is based on a Least Recently Used (LRU) algorithm. Further examples may use LRU as a weighting factor in determining whether to remove a memory page as compared to other potential candidate pages. In some cases, many memory pages will need to be examined in RAM before suitable candidate pages for paging-out can be found. A candidate page is a memory page that is selected by a data processing system's page replacement software for paging-out to persistent storage when the next page-out cycle occurs. Paging-out is an operation where the contents of a physical memory corresponding to the memory page are copied to persistent storage, and optionally, a status bit is set to indicate that the physical memory is unused. Various user-tunable thresholds influence the operation of the page-replacement algorithm. Such thresholds include, for example, minfree, the minimum acceptable number of real memory page frames in the free list, and maxfree, the maximum size to which the free list will grow by VMM page stealing.
Finding a suitable candidate page in physical memory to replace can be a lengthy process. In addition, paging-out of a memory page from physical memory can be a lengthy process since the contents of the memory page being paged-out are saved to persistent storage if its contents have changed since being loaded into the physical memory. Accordingly, process improvements may occur if a list of candidate pages were limited to a more compact set of better candidates for paging out.